3.1453 \(\int \csc (c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx\)

Optimal. Leaf size=46 \[ \frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac {a^2 \tanh ^{-1}(\cos (c+d x))}{d}+\frac {2 a b \tan (c+d x)}{d} \]

[Out]

-a^2*arctanh(cos(d*x+c))/d+(a^2+b^2)*sec(d*x+c)/d+2*a*b*tan(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.17, antiderivative size = 70, normalized size of antiderivative = 1.52, number of steps used = 8, number of rules used = 8, integrand size = 27, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.296, Rules used = {2911, 3767, 8, 3201, 446, 78, 63, 206} \[ \frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac {a^2 \sqrt {\cos ^2(c+d x)} \sec (c+d x) \tanh ^{-1}\left (\sqrt {\cos ^2(c+d x)}\right )}{d}+\frac {2 a b \tan (c+d x)}{d} \]

Antiderivative was successfully verified.

[In]

Int[Csc[c + d*x]*Sec[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

((a^2 + b^2)*Sec[c + d*x])/d - (a^2*ArcTanh[Sqrt[Cos[c + d*x]^2]]*Sqrt[Cos[c + d*x]^2]*Sec[c + d*x])/d + (2*a*
b*Tan[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 63

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - (a*d)/b + (d*x^p)/b)^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 78

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> -Simp[((b*e - a*f
)*(c + d*x)^(n + 1)*(e + f*x)^(p + 1))/(f*(p + 1)*(c*f - d*e)), x] - Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1)
+ c*f*(p + 1)))/(f*(p + 1)*(c*f - d*e)), Int[(c + d*x)^n*(e + f*x)^(p + 1), x], x] /; FreeQ[{a, b, c, d, e, f,
 n}, x] && LtQ[p, -1] && ( !LtQ[n, -1] || IntegerQ[p] ||  !(IntegerQ[n] ||  !(EqQ[e, 0] ||  !(EqQ[c, 0] || LtQ
[p, n]))))

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 446

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Dist[1/n, Subst[Int
[x^(Simplify[(m + 1)/n] - 1)*(a + b*x)^p*(c + d*x)^q, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p, q}, x] &&
 NeQ[b*c - a*d, 0] && IntegerQ[Simplify[(m + 1)/n]]

Rule 2911

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_)*((a_) + (b_.)*sin[(e_.) + (f_.)*
(x_)])^2, x_Symbol] :> Dist[(2*a*b)/d, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^(n + 1), x], x] + Int[(g*Cos[e
+ f*x])^p*(d*Sin[e + f*x])^n*(a^2 + b^2*Sin[e + f*x]^2), x] /; FreeQ[{a, b, d, e, f, g, n, p}, x] && NeQ[a^2 -
 b^2, 0]

Rule 3201

Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2
)^(p_.), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Dist[(ff*Sqrt[Cos[e + f*x]^2])/(f*Cos[e + f*x]
), Subst[Int[(d*ff*x)^n*(1 - ff^2*x^2)^((m - 1)/2)*(a + b*ff^2*x^2)^p, x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{
a, b, d, e, f, n, p}, x] && IntegerQ[m/2]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rubi steps

\begin {align*} \int \csc (c+d x) \sec ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=(2 a b) \int \sec ^2(c+d x) \, dx+\int \csc (c+d x) \sec ^2(c+d x) \left (a^2+b^2 \sin ^2(c+d x)\right ) \, dx\\ &=-\frac {(2 a b) \operatorname {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d}+\frac {\left (\sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {a^2+b^2 x^2}{x \left (1-x^2\right )^{3/2}} \, dx,x,\sin (c+d x)\right )}{d}\\ &=\frac {2 a b \tan (c+d x)}{d}+\frac {\left (\sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {a^2+b^2 x}{(1-x)^{3/2} x} \, dx,x,\sin ^2(c+d x)\right )}{2 d}\\ &=\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {2 a b \tan (c+d x)}{d}+\frac {\left (a^2 \sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {1}{\sqrt {1-x} x} \, dx,x,\sin ^2(c+d x)\right )}{2 d}\\ &=\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}+\frac {2 a b \tan (c+d x)}{d}-\frac {\left (a^2 \sqrt {\cos ^2(c+d x)} \sec (c+d x)\right ) \operatorname {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sqrt {\cos ^2(c+d x)}\right )}{d}\\ &=\frac {\left (a^2+b^2\right ) \sec (c+d x)}{d}-\frac {a^2 \tanh ^{-1}\left (\sqrt {\cos ^2(c+d x)}\right ) \sqrt {\cos ^2(c+d x)} \sec (c+d x)}{d}+\frac {2 a b \tan (c+d x)}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.20, size = 58, normalized size = 1.26 \[ \frac {\left (a^2+b^2\right ) \sec (c+d x)+a \left (a \left (\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )\right )+2 b \tan (c+d x)\right )}{d} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[c + d*x]*Sec[c + d*x]^2*(a + b*Sin[c + d*x])^2,x]

[Out]

((a^2 + b^2)*Sec[c + d*x] + a*(a*(-Log[Cos[(c + d*x)/2]] + Log[Sin[(c + d*x)/2]]) + 2*b*Tan[c + d*x]))/d

________________________________________________________________________________________

fricas [A]  time = 0.45, size = 77, normalized size = 1.67 \[ -\frac {a^{2} \cos \left (d x + c\right ) \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - a^{2} \cos \left (d x + c\right ) \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - 4 \, a b \sin \left (d x + c\right ) - 2 \, a^{2} - 2 \, b^{2}}{2 \, d \cos \left (d x + c\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/2*(a^2*cos(d*x + c)*log(1/2*cos(d*x + c) + 1/2) - a^2*cos(d*x + c)*log(-1/2*cos(d*x + c) + 1/2) - 4*a*b*sin
(d*x + c) - 2*a^2 - 2*b^2)/(d*cos(d*x + c))

________________________________________________________________________________________

giac [A]  time = 0.21, size = 57, normalized size = 1.24 \[ \frac {a^{2} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - \frac {2 \, {\left (2 \, a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a^{2} + b^{2}\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

(a^2*log(abs(tan(1/2*d*x + 1/2*c))) - 2*(2*a*b*tan(1/2*d*x + 1/2*c) + a^2 + b^2)/(tan(1/2*d*x + 1/2*c)^2 - 1))
/d

________________________________________________________________________________________

maple [A]  time = 0.55, size = 68, normalized size = 1.48 \[ \frac {a^{2}}{d \cos \left (d x +c \right )}+\frac {a^{2} \ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{d}+\frac {2 a b \tan \left (d x +c \right )}{d}+\frac {b^{2}}{d \cos \left (d x +c \right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(d*x+c)*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x)

[Out]

1/d*a^2/cos(d*x+c)+1/d*a^2*ln(csc(d*x+c)-cot(d*x+c))+2*a*b*tan(d*x+c)/d+1/d*b^2/cos(d*x+c)

________________________________________________________________________________________

maxima [A]  time = 0.36, size = 64, normalized size = 1.39 \[ \frac {a^{2} {\left (\frac {2}{\cos \left (d x + c\right )} - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )} + 4 \, a b \tan \left (d x + c\right ) + \frac {2 \, b^{2}}{\cos \left (d x + c\right )}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)*sec(d*x+c)^2*(a+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

1/2*(a^2*(2/cos(d*x + c) - log(cos(d*x + c) + 1) + log(cos(d*x + c) - 1)) + 4*a*b*tan(d*x + c) + 2*b^2/cos(d*x
 + c))/d

________________________________________________________________________________________

mupad [B]  time = 11.85, size = 62, normalized size = 1.35 \[ \frac {a^2\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {2\,a^2+4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a\,b+2\,b^2}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*sin(c + d*x))^2/(cos(c + d*x)^2*sin(c + d*x)),x)

[Out]

(a^2*log(tan(c/2 + (d*x)/2)))/d - (2*a^2 + 2*b^2 + 4*a*b*tan(c/2 + (d*x)/2))/(d*(tan(c/2 + (d*x)/2)^2 - 1))

________________________________________________________________________________________

sympy [F(-1)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Timed out} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(d*x+c)*sec(d*x+c)**2*(a+b*sin(d*x+c))**2,x)

[Out]

Timed out

________________________________________________________________________________________